package com.zhouchb.test;


import org.hamcrest.core.SubstringMatcher;

import java.util.Arrays;

/**
 * @Create 2023-09-19 17:15
 * @Description
 */
public class 斐波那契数 {
    public static void main(String[] args) {
        int x=0,y=1,result,sum=0;
       for (int i=0;i<8;i++){
           if (i==0){
               result = x;
               sum+=result;
               System.out.println(result);
               continue;
           }
           if (i == 1){
               result = y;
               System.out.println(result);
               sum+=result;
               continue;
           }
           result = x + y;
           x = y;
           y = result;
           sum+=result;
           System.out.println(result);
       }
        System.out.println(sum);
    }

// 0,1,1,2,3,5

}
class maopao{
    public static void main(String[] args) {
        int[] arr = {2,3,6,2,4};int temp;
        for (int i=0;i<arr.length;i++){
            for (int j=arr.length-1;j>i;j--){
                if (arr[j]<arr[j-1]){
                    temp = arr[j];
                    arr[j] = arr[j-1];
                    arr[j-1] = temp;
                }
            }
        }
        System.out.println(Arrays.toString(arr));
    }
}

